// Test.LibUtils.Aux.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#define OTL_ODBC 
#include "otlv4.h"

#include "otldb.h"

otl_connect d;

struct  xxx
{
	std::string usrnoam;
	otl_datetime time;
	float checkval;
};
   
otl_stream& operator >> (otl_stream& os, xxx& v)
{
	char buff[16] = {0};
	os>>buff;
	v.usrnoam = buff;
	os>>v.time;
	os>>v.checkval;
	return os;
}

void test1()
{
	//COTLDB::register_sqlite(_T("test"),_T("c:\\test.db"));
	COTLDB db;
	db.Connect("dddxxx","","");
	otl_stream result;
	xxx data;
	db.Select("select * from AMMETERUSAGE",&result);
	//db.ExcuteSql("")
	while(!result.eof())
	{
		result>>data;
		std::cout<<data.time.year << " " <<data.usrnoam<<std::endl;
	}


}


int _tmain(int argc, _TCHAR* argv[])
{
	test1();
	return 0;
}

